home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / utilitys / 104 / yaps.doc < prev   
Encoding:
Text File  |  1987-09-20  |  12.4 KB  |  200 lines

  1.  
  2.                              "THE BEGINNING"
  3.  
  4.         So you purchased a 520ST computer. You did so because of its price (a-
  5. huh), but also because is was advertised as being a "powerful" computer using
  6. Motorola's FAST "68000 CPU".  So you rush home with your computer, monitor, and
  7. disk drive and put it all together. Then you get a fancy word processor and new
  8. printer, and, voila', you can now write letters to your Aunt May!
  9.  
  10.         Five weeks later (maybe sooner if you read ST Log) you begin to notice
  11. that your FAST computer runs everything at "great-guns" until it comes time to
  12. print out that letter to Aunt May. The computer then slows down to an "ants
  13. pace" (pun intended) while it WAITS for your slow-as-molasses printer to punch
  14. out that letter. Isn't there a faster and better way to print out that letter
  15. without spending any more money? YES!!!! Why not use your speedy computer to
  16. store your letter in a buffer, sending it to your printer character-by-charac-
  17. ter at the printer's slow pace, and otherwise running other wonderful programs
  18. that you tell it to.
  19.  
  20.         And that's what a "Yet Another Printer Spooler" (YAPS for short) does
  21. for you. This little program wedges itself permanently in memory (or until you
  22. turn off or reset your computer). It then patches itself into the operating
  23. system (low level BIOS calls) and waits for someone to send a character to the
  24. printer. When that happens, it checks to see if your printer is busy printing a
  25. character. If the printer is not YAPS sends it a character to print. However,
  26. if it is busy, YAPS will store that character in a buffer and return to your
  27. program.  Then YAPS "wakes up" and checks to see if your printer is ready to
  28. receive another character. If so, it sends one on and then returns control to
  29. any program you happen to be running.
  30.  
  31.  
  32.                                "THE SETUP"
  33.  
  34.         "Yet Another Printer Spooler" works with practically all printers that
  35. connect to the Centronics Printer Port in the back of your ST computer. It will
  36. even work with some printers that do not work with TOS (see below for Why?).
  37. YAPS can be run at any time to set up its buffer and patch itself into the
  38. operating system, but is probably MOST effective if run at the time you turn on
  39. your computer.
  40.  
  41.         There are two (2) versions of YAPS included in the arc'd file,
  42. YAPS_C.PRG and YAPS_T.PRG.  YAPS_C.PRG uses the Centronics Busy Signal
  43. interrupt to know when to send characters to your printer. It therefore is the
  44. most efficient of the two versions, and runs generally faster (especially if
  45. graphic information is being sent to the printer, as with Publishing Partner).
  46. YAPS_T.PRG runs off of timer C. This version is compatible with more printers
  47. than YAPS_C.PRG, but may, in certain instances, run noticeably slower. Try
  48. using YAPS_C.PRG first, switching to YAPS_T.PRG if you have problems with a
  49. particular application or printer.
  50.  
  51.         Before you run YAPS you should decide how big a buffer you want
  52. to be set up. The default size is a 32 k (kilobyte) buffer, but any size up to
  53. the available size of your memory can be set up! You must then change the name
  54. of the program you want to use to reflect the size of the buffer you want to
  55. set up. For instance, if you run "Yet Another Printer Spooler" with the name
  56. YAPS64.PRG a 64 k buffer will be set up to store printer characters. If you own
  57. one of the new MEGA ST's and want to set up a 1500 k buffer (a whopping size),
  58. then you would rename the program YAPS1500.PRG before running it. The smallest
  59. size buffer that can be set up is 1 kilobyte in length (YAPS1.PRG). Remember,
  60. however, that the program name must begin with YAPS and have an extension of
  61. PRG for everything to work properly.
  62.  
  63.         The program can be run from the GEM desktop. However, you can also
  64. start YAPS automatically. To do so, format a new diskette, and create a
  65. folder called AUTO. Then copy all programs that you wish to run at the time
  66. you turn on your ST computer into this folder, INCLUDING the YAPS file that
  67. you just renamed. The next time you turn on your computer make sure that this
  68. diskette is in DRIVE A, and "Yet Another Printer Spooler" will load in auto-
  69. matically.
  70.  
  71.  
  72.                        "SOME ADDITIONAL FEATURES"
  73.  
  74.      There are a few more features that YAPS has to make your life easier:
  75.  
  76.    (1) When YAPS is run, if you press either the "Alternate", "Shift", or
  77.        "Control" keys,  the  installation of the  printer spooler will be
  78.        aborted. A  somewhat rude message  will appear then,  telling  you
  79.        of the abortion (I  mean aborted installation...).  You can  still
  80.        load in YAPS at any time from the GEM desktop.  Remember to  first
  81.        rename the program to reflect the  size of the printer buffer that
  82.        you want to be set up.
  83.  
  84.    (2) If there is not enough memory  available to set up the buffer size
  85.        specified in the program name,  installation will be aborted,  and
  86.        a message printed on your screen indicating this.
  87.  
  88.    (3) If YAPS can not  interpret the  size of the buffer needed,  or can
  89.        not find the program name, a 32 k (default) buffer will be set up.
  90.  
  91.    (4) There  is a  way to  CLEAR the  buffer before YAPS  has  completed
  92.        spooling the  characters to your printer.  If you  run the program
  93.        again after it has already been installed,  you will get a message
  94.        indicating that the  printer spooler is running, and asking if you
  95.        want to clear to buffer.  Press  "Y"  to do so, or "N" not to stop
  96.        the printing.
  97.  
  98.  
  99.                          "THE TECHNICAL ASPECTS"
  100.  
  101.         "Yet Another Printer Spooler" is written in assembly language using
  102. Abacus's ASSEMPRO. It works by stealing the BIOS (trap #13) vector from the
  103. operating system, and then checks for CONOUT and CONSTAT calls directed at
  104. the printer.  All other BIOS calls are passed on to the operating system.
  105.  
  106.         As the program starts it first checks to see if another version of YAPS
  107. has already been installed by looking for the 8 byte name "YAPS.PRG" near the
  108. beginning of the trap #13 code. If the name is found, the program informs the
  109. user that "Yet Another Printer Spooler" is already active. It then gives the
  110. option to clear the printer buffer of its contents.
  111.  
  112.         In the next step YAPS looks for its name by doing a GEMDOS directory
  113. search using the wildcard mask "YAPS*.PRG". If no match is found in the current
  114. directory, YAPS will look for a match in an AUTO folder. I know of no other way
  115. to get the program name other that doing a directory search, and still be able
  116. to run YAPS in an AUTO folder. There is an inherent limitation; YAPS will find
  117. the FIRST match to the wildcard mask, and NOT necessarily the actual program
  118. name run. For instance, suppose a copy of YAPS is kept BOTH in the root direct-
  119. ory (ie. - not in any folder) AND in an AUTO folder of a boot diskette. The
  120. filename in the root directory will ALWAYS be found first. This filename ONLY
  121. will be used to determine the size of the printer buffer to set up even if the
  122. program is run from the AUTO folder when the computer is booted. So a good rule
  123. of thumb when using YAPS is to try NOT to keep multiple copies of the program
  124. around on the same diskette.
  125.  
  126.         After the buffer size is determined, YAPS then either ties in the
  127. printer spooler portion of the program to the 200 hz. system timer (TIMER C of
  128. the MFP chip) or sets up the Centronics Busy Signal Interrupt Routine
  129. (depending on what version of YAPS you are running). YAPS_T.PRG uses the XBIOS
  130. SETEXEC call to find the current TIMER C vector, then uses the same call to
  131. chain the printer spooler routine with the current TIMER C handler.  I chose
  132. to use TIMER C in order to be compatible with most other applications run.
  133. Using TIMER A and resetting to a faster speed (lets say 700 hz.) may increase
  134. to speed of spooling with those printers that have no more than 1 line of
  135. buffer, but at the cost of being potentially incompatible with other
  136. applications that may use this timer for there own purposes. For the vast
  137. majority of printers the speed of printing should be no different with the
  138. spooler as compared to the operating system calls.
  139.  
  140.         If you plan to print graphic material with your printer (as with many
  141. drawing and publishing programs currently available), you will find that the
  142. timer C version will not be able to feed the graphic information to your
  143. printer as fast as it can handle it. Your printing can, in fact, run SLOWER in
  144. these cases than if you did not have any printer spooler installed. For this
  145. reason a second version of YAPS is supplied, YAPS_C.PRG. This version runs off
  146. of the Centronics Busy Signal Interrupt (also of the MFP chip); that is it
  147. sends characters to the printer at the exact time the printer is ready to
  148. receive characters, not by polling the state of the printer when using TIMER C.
  149. This version may potentially not be compatible with some applications, since
  150. it steals rather than chains to the Centronics Busy Signal Interrupt Vector
  151. (I have yet to find any application that it can not run with so far). This
  152. version of YAPS may also not driver certain printers properly (such as the
  153. Texas Instruments model 810), though it will probably work with more than 98%
  154. of printers currently on the market.
  155.  
  156.         To finalize the setup, the SETEXEC call is again used to steal the
  157. trap #13 (BIOS) vector. Finally the program is exited using the GEMDOS KEEP
  158. call to retain the printer spooler with its buffer in memory.
  159.  
  160.         I originally wrote this printer spooler to work with Texas Instruments
  161. (TI) 810, 880, and 850 printers (these are heavy duty printers frequently used
  162. by the airlines and ticket agencies). These three printers do not work with
  163. the current operating system print routines. If these printers are attached to
  164. any ST computer, DUPLICATE characters will be appear on any document printed.
  165. The fault lies with each manufacturers interpretation of the Centronics Para-
  166. llel Interface Protocol. In order for the printer to grab or "latch" on to a
  167. character to print, it has to know when the character is available. The compu-
  168. ter signals the printer when ready by flashing a flag called the STROBE. The
  169. STROBE signal must be pulsed a minimal amount of time before the printer will
  170. recognize that there is a character to print and grab it. The Parallel Inter-
  171. face Protocol specifies this MINIMAL time to be either 0.5 or 1 microsecond for
  172. almost all printers. The protocol does NOT specify a MAXIMUM time, and that is
  173. where that problem arises with some printers. Most printers (let's say 95%) not
  174. only wait for this STROBE flag to be raised (or technically set LOW), but they
  175. also wait for the STROBE flag to be dropped (or technically set HIGH) before
  176. they process the character and look for another one. A few printers latch onto
  177. and process the character sent to them as soon as the STROBE flag is raised.
  178. After they finish processing the character, if the STROBE flag is still raised,
  179. they latch onto the same character and print it! It then becomes critical that
  180. the ST computer flash the STROBE as near to the minimal time specified in the
  181. Parallel Interface Protocol as possible in order to work properly with these
  182. "few" printers.
  183.  
  184.         The STROBE signal is controlled by the Yamaha YM-2149 Programmable
  185. Sound Generator (PSG) chip. The normal BIOS call to send a character to the
  186. printer pulses the STROBE for greater than 8 microseconds. Mind you this pulse
  187. width agrees with the Centronics Parallel Interface Protocol (since only a min-
  188. imal time is specified), but is too long for a few printers. I have optimized
  189. the code that loads the PSG chip with a character and flashes the strobe (only
  190. four assembly instructions long). This decreases the STROBE pulse width to
  191. 1.5 to 2 microseconds (a limitation of the PSG chip, not the 68000 CPU), small
  192. enough to make a big difference! Now all the TI 880 and 885 printers work
  193. perfectly fine with the ST computer IF YAPS IS INSTALLED FIRST BEFORE PRINTING.
  194. The TI 810 printers are apparently more finicky unfortunately. One out of two
  195. printers that I have at my office works fine. The other will duplicate 1 char-
  196. acter out of 20,000 characters (yes, that's twenty thousand) sent to it on the
  197. average. This patch is not perfect, but darn well tries to be so. And at least
  198. with YAPS_T.PRG installed I estimate that with YAPS installed you can use more
  199. than 99% of Centronics compatible printers currently available on the market!
  200.